﻿package
{
	import flash.display.*;
	import flash.system.Capabilities;
	import flash.desktop.NativeApplication;

	class Errors
	{
		public function Errors(_message)
		{
			var tempError:Error = new Error();
			var stackTrace:String = tempError.getStackTrace();

			var options:NativeWindowInitOptions = new NativeWindowInitOptions();
			options.systemChrome = NativeWindowSystemChrome.NONE;
			options.type = NativeWindowType.LIGHTWEIGHT;
			options.transparent = true;
			options.maximizable = false;
			options.resizable = false;
			
			var win:NativeWindow = new NativeWindow(options);
			win.width = 421;
			win.height = 136;
			win.stage.scaleMode = "noScale";
			win.stage.align = StageAlign.TOP_LEFT;
			win.alwaysInFront = true;
			
			var error:Errors_mc = new Errors_mc();
			_message = _message+"\n"+stackTrace;
			error.error_message.text = _message;
			
			win.stage.addChild(error);
			win.activate();
			
			win.x = (Capabilities.screenResolutionX - win.width) / 2;
			win.y = (Capabilities.screenResolutionY - win.height) / 2;		
		}
	}
}